package jmu.cyxwcy.librarymanagement.controller;

import jmu.cyxwcy.librarymanagement.pojo.Book;
import jmu.cyxwcy.librarymanagement.pojo.Mail;
import jmu.cyxwcy.librarymanagement.pojo.Result;
import jmu.cyxwcy.librarymanagement.service.impl.MailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/mail")
public class MailController {
    @Autowired
    private MailService mailService;

    //邮件催还
    @PostMapping("/return")
    public Result urgeTheReturnOfBooks(@RequestParam String to) {//to是收件人邮箱
        String subject="请尽快归还图书";
        String text="详情见网站";
        mailService.checkMail(to,subject,text);
        mailService.sendTextMailMessage(to,subject,text);
        return Result.success();
    }
}
